// 游戏主入口文件
import GameManager from './game/GameManager';

export default class StockKLineGame {
  constructor() {
    this.gameManager = null;
    this.canvas = null;
    this.ctx = null;
  }

  init() {
    // --- 1. 创建两个 Canvas ---
    // 注意：在微信开发者工具中，后创建的 Canvas 会显示在上层
    // this.gameCanvas = wx.createCanvas();
    // this.uiCanvas = wx.createCanvas();

    // // --- 2. 获取 2D 渲染上下文 ---
    // this.gameCtx = this.gameCanvas.getContext('2d');
    // this.uiCtx = this.uiCanvas.getContext('2d');

    // // --- 3. 设置画布尺寸 ---
    // // 获取系统信息来设置画布为全屏
    // const systemInfo = wx.getWindowInfo();

    // const screenWidth = systemInfo.screenWidth;
    // const screenHeight = systemInfo.screenHeight;

    // this.gameCanvas.width = screenWidth * 2;
    // this.gameCanvas.height = screenHeight * 2;
    // this.uiCanvas.width = screenWidth * 2;
    // this.uiCanvas.height = screenHeight * 2;

    // 创建画布 - 横屏适配
    this.canvas = wx.createCanvas();
    this.ctx = this.canvas.getContext('2d');

    // 设置横屏尺寸
    this.canvas.width = 1624;
    this.canvas.height = 750;

    // 初始化游戏管理器
    this.gameManager = new GameManager(this.canvas, this.ctx);
    this.gameManager.init();
  }
}

// 微信小游戏入口
const game = new StockKLineGame();
game.init();